<template>
  <div class="detailTitle">
    <div class="title">{{ goodsInfo.title }}</div>
    <div class="price_box">
      <span class="now_price">{{ goodsInfo.price }}</span>
      <div class="old_price_box">
        <span class="old_price">{{ goodsInfo.oldPrice }}</span
        ><span class="discountDesc" v-if="goodsInfo.discountDesc">{{
          goodsInfo.discountDesc
        }}</span>
      </div>
    </div>
    <div class="columns">
      <div v-for="(item, index) in goodsInfo.columns" :key="index">
        {{ item }}
      </div>
    </div>
    <div class="servces">
      <div
        class="servce-item"
        v-for="(item, index) in goodsInfo.service"
        :key="index"
      >
        <img :src="goodsInfo.service[0].icon" alt="" />{{ item.name }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "DetailTitle",
  props: {
    goodsInfo: {
      type: Object,
      default() {
        return {};
      },
    },
  },
};
</script>

<style scoped>
.detailTitle {
  padding: 15px 10px 0;
  border-bottom: 5px solid #fafafa;
}
.detailTitle .title {
  font-size: 17px;
  font-family: "微软雅黑";
  color: black;
  text-overflow: -o-ellipsis-lastline;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.price_box {
  margin-top: 15px;
  position: relative;
}
.price_box .now_price {
  font-size: 20px;
  color: #f00;
}
.price_box .old_price_box {
  position: relative;
  display: inline-block;
}
.price_box .old_price {
  margin-left: 3px;
  text-decoration: line-through;
  font-size: 14px;
  color: #aaa;
}
.price_box .discountDesc {
  padding: 3px 10px;
  font-size: 12px;
  background-color: var(--color-high-text);
  border-radius: 10px;
  position: relative;
  left: 5px;
  top: -10px;
  color: #fff;
}
.columns {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 15px;
  color: #aaa;
}
.servces {
  display: flex;
  justify-content: flex-start;
  border-top: 5px solid #fcfcfc;
  padding: 20px 0px;
  font-size: 12px;
  color: #333;
  flex-wrap: wrap;
}
.servce-item {
  margin-left: 5px;
  margin-top: 10px;
}
.servce-item img {
  width: 15px;
  vertical-align: middle;
  margin-right: 5px;
}
</style>